/**
 * Copyright (C) 2018-2020
 * All rights reserved, Designed By www.yixiang.co
 * 注意：
 * 本软件为www.yixiang.co开发研制
 */
package co.yixiang.modules.shop.domain;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import com.baomidou.mybatisplus.annotation.TableName;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.io.Serializable;

/**
 * @author chajiu
 * @date 2021-04-22
 */
@Data
@TableName("yx_user_address")
public class YxUserAddress implements Serializable {

    /** 用户地址id */
    @ApiModelProperty(value = "用户地址id")
    @TableId
    private Long id;


    /** 用户id */
    @ApiModelProperty(value = "用户id")
    @NotNull
    private Long uid;


    /** 收货人姓名 */
    @ApiModelProperty(value = "收货人姓名")
    @NotBlank
    private String realName;


    /** 收货人电话 */
    @ApiModelProperty(value = "收货人电话")
    @NotBlank
    private String phone;


    /** 收货人所在省 */
    @ApiModelProperty(value = "收货人所在省")
    @NotBlank
    private String province;


    /** 收货人所在市 */
    @ApiModelProperty(value = "收货人所在市")
    @NotBlank
    private String city;


    private Integer cityId;


    /** 收货人所在区 */
    @ApiModelProperty(value = "收货人所在区")
    @NotBlank
    private String district;


    /** 收货人详细地址 */
    @ApiModelProperty(value = "收货人详细地址")
    @NotBlank
    private String detail;


    /** 邮编 */
    @ApiModelProperty(value = "邮编")
    @NotBlank
    private String postCode;


    /** 经度 */
    @ApiModelProperty(value = "经度")
    @NotBlank
    private String longitude;


    /** 纬度 */
    @ApiModelProperty(value = "纬度")
    @NotBlank
    private String latitude;


    /** 是否默认 */
    @ApiModelProperty(value = "是否默认 1是 0不是")
    @NotNull
    private Integer isDefault;


    /** 是否删除 */
    @ApiModelProperty(value = "是否删除")
    @NotNull
    private Integer isDel;


    /** 添加时间 */
    @ApiModelProperty(value = "添加时间")
    @NotNull
    @TableField(fill = FieldFill.INSERT)
    private Timestamp createTime;


    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Timestamp updateTime;


    public void copy(YxUserAddress source) {
        BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
